package com.ourcraft.informationcollectionsystem.utils.statusCode;

import com.ourcraft.informationcollectionsystem.entity.Company;

public enum CompanyRecordStatus {
    NOT_FILL(0),
    NOT_SUBMIT(1),
    WAIT_EXAMINE(2),
    RETURNED(3),
    PASS(4);

    public final Integer status;

    CompanyRecordStatus(Integer status) {
        this.status = status;
    }

    public static CompanyRecordStatus build(Integer status) {
        if (status == null) return null;
        return switch (status) {
            case 0 -> NOT_FILL;
            case 1 -> NOT_SUBMIT;
            case 2 -> WAIT_EXAMINE;
            case 3 -> RETURNED;
            case 4 -> PASS;
            default -> null;
        };
    }

    public CompanyRecordStatus save() {
        return switch (this) {
            case NOT_FILL, NOT_SUBMIT -> NOT_SUBMIT;
            case RETURNED -> RETURNED;
            default -> null;
        };
    }

    public CompanyRecordStatus submit() {
        return switch (this) {
            case NOT_FILL, NOT_SUBMIT, RETURNED -> WAIT_EXAMINE;
            default -> null;
        };
    }

    public CompanyRecordStatus pass() {
        return switch (this) {
            case WAIT_EXAMINE -> PASS;
            default -> null;
        };
    }

    public CompanyRecordStatus returned() {
        return switch (this) {
            case WAIT_EXAMINE -> RETURNED;
            default -> null;
        };
    }
}
